package woaini.fenger.task;

import lombok.extern.slf4j.Slf4j;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;
import woaini.fenger.core.bot.base.Bot;
import woaini.fenger.core.bot.enums.PLatFormEnum;
import woaini.fenger.core.bot.event.Messages;
import woaini.fenger.core.bot.id.ID;
import woaini.fenger.core.bot.manager.BotManager;
import woaini.fenger.core.bot.manager.key.BotKey;
import woaini.fenger.core.task.anno.BotTask;

 @Component
@Slf4j
@DisallowConcurrentExecution
@BotTask(name = "每日签到",description = "用于签到打卡")
public class SignInTask extends QuartzJobBean {

     @Autowired
     BotManager botManager;

    @Override
    protected void executeInternal(JobExecutionContext context){
        Bot bot = botManager.getBot(new BotKey(ID.of("355242685"), PLatFormEnum.QQ));
        bot.getBotAdapter().sendGroupMsg(ID.of("856337734"), new Messages().text("签到"), false);
    }
}
